home *** CD-ROM | disk | FTP | other *** search
- /*
- * HyperSearch_Results_to_Buffer.bsh - a Beanshell macro
- * for jEdit text that writes HyperSearch results
- * matches to a new buffer in the format:
- *
- * <filename> :<linenum>: <line text>
- *
- * Copyright (C) 2002, 2003 Ollie Rutherfurd <oliver@rutherfurd.net>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id: HyperSearch_Results_to_Buffer.bsh,v 1.1 2003/11/12 00:24:11 spestov Exp $
- */
-
- writeHypersearchResultsToBuffer(View view){
- hs = view.getDockableWindowManager().getDockableWindow("hypersearch-results");
- if (hs == null)
- {
- Macros.error(view, "The 'HyperSearch Results' window is not open.");
- return;
- }
-
- root = hs.getTreeModel().getRoot();
- if(root == null)
- {
- Macros.error(view, "No HyperSearch matches.");
- return;
- }
-
- node = root.getFirstChild();
- while(node.getNextSibling() != null)
- {
- node = node.getNextSibling();
- }
- node = node.getFirstChild();
-
- results = new StringBuffer();
- while(node != null)
- {
- path = node.getUserObject().toString();
- match = node.getFirstChild();
- while(match != null)
- {
- text = match.getUserObject().str;
- results.append(path + " :" + text + "\n");
- match = match.getNextSibling();
- }
- node = node.getNextSibling();
- }
-
- text = results.toString();
- if(text.length() > 0)
- {
- jEdit.newFile(view);
- view.getTextArea().setText(text);
- }
- }
-
- writeHypersearchResultsToBuffer(view);
-
- /*
- Macro index data (in DocBook format)
-
- <listitem>
- <para><filename>HyperSearch_Results_to_Buffer.bsh</filename></para>
- <abstract><para>
- Writes HyperSeach results to a new buffer.
- </para></abstract>
- </listitem>
-
- */
-
- // :wrap=none:collapseFolds=0:noTabs=false:lineSeparator=\n:maxLineLen=80:indentSize=4:deepIndent=false:folding=none:
-